<template>
  <div id="header">
    <!-- 头部 -->
    <div class="left">
      <van-icon v-show="showBack" name="arrow-left" @click="backHandle" />
    </div>
    <div class="center title">
      <h4>{{title}}</h4>
    </div>
    <div class="right">
      <span class="backHome" @click="$router.push(`/home`)" v-show="showHome"></span>
    </div>
  </div>
</template>
<script>
import { mapMutations, mapState } from "vuex";
export default {
  data() {
    return {
      searchVal: "",
      val: "编辑"
    };
  },
  created() {},
  props: ["showBack", "showHome", "showSetting"],
  components: {},
  computed: {
    ...mapState({
      title: state => state.title
    })
  },
  methods: {
    backHandle() {
      this.$router.go(-1);
    }
  }
};
</script>
<style lang="scss" scoped type="text/scss">
#header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0.88rem;
  display: flex;
  // margin-bottom: 0.26rem;
  z-index: 999;
  padding: 0.1rem 0.2rem;
  box-sizing: border-box;
  justify-content: space-between;
  align-items: center;
  // background: linear-gradient(to left, #738aff, #5b60ff);
  background: #fff;
  box-shadow: 0 0.05rem 0.1rem rgba(0, 0, 0, 0.07);
  > div {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    span {
      display: block;
    }
  }
  .left {
    flex: 1;
    font-size: 0.36rem;
    font-weight: bold;
    color: #40404c;
  }
  .center {
    width: 5.36rem;
    padding: 0 0.4rem;
    box-sizing: border-box;
    &.title {
      h4 {
        font-weight: 500;
        font-size: 0.36rem;
        letter-spacing: 0.03rem;
        color: #40404c;
      }
    }
  }
  .right {
    flex: 1;
    font-size: 0.36rem;
    font-weight: bold;
    color: #40404c;
    span {
      width: 0.4rem;
      height: 0.4rem;
      position: relative;
      &.backHome {
        width: 0.44rem;
        height: 0.4rem;
        background: url("~@/assets/img/common/home@2x.png") no-repeat center /
          100% 100%;
      }
    }
  }
}
</style>